package jse.test20160508ListCompareble;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.junit.Test;

/**
 * @desc	测试list自定义排序 
 * @author kanggw
 * @datetime 2016年5月8日,上午9:09:30
 */

public class TestListCom {
	
	@Test
	public void test() {
		
		List<Employee> employees = new ArrayList<Employee>();
		Employee employee1 = new Employee(1, "康康", 25);
		Employee employee2 = new Employee(2, "汪汪", 24);
		Employee employee3 = new Employee(3,"哈哈",26);
		
		employees.add(employee3);
		employees.add(employee2);
		employees.add(employee1);
		
		System.out.println("排序前");
		for(Employee employee : employees) {
			System.out.println(employee);
		}
		
		System.out.println("排序后");
		
		Collections.sort(employees);
		
		for(Employee employee : employees) {
			System.out.println(employee);
		}
	}
	
	
}
